how to solve type error in python